﻿using FluentNHibernate.Mapping;
using SmallTune.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmallTune.Mappings
{
    public class ArtistMap : ClassMap<Artist>
    {
        public ArtistMap()
        {
            Id(x => x.id);

            Map(x => x.created);
            Map(x => x.lastChanged);

            HasManyToMany(x => x.listOfAlbums)
                .Cascade.All()
                .Table("AlbumsArtists");

            HasManyToMany(x => x.listOfSongs)
                .Cascade.All()
                .Inverse()
                .Table("ArtistsSongs");

            Map(x => x.name);
            
        }
    }
}
